package com.xydpeng.tech.member;

import com.xydpeng.tech.member.service.TestCommandLineRunner;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.MutablePropertySources;

/**
 * @author xydpeng
 * @version v1.0
 * @date: 2024/5/15
 * @description:
 */
@EnableDiscoveryClient
@SpringBootApplication
@MapperScan(basePackages = "com.xydpeng.tech.member.dao")
public class MemberServerApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(MemberServerApplication.class, args);
        MutablePropertySources propertySources = context.getEnvironment().getPropertySources();
        TestCommandLineRunner runner = context.getBean(TestCommandLineRunner.class);
        new Thread(()-> {
            for (int i = 0; i < 100; i++) {
                try {
                    runner.test2();

                    Thread.sleep(6000);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }).start();

    }
}
